Fix PAE ptep_get_and_clear_full(). The fast path requires us to manually clear
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 14 Mar 2006 14:25:33 +0000 (15:25 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 14 Mar 2006 14:25:33 +0000 (15:25 +0100)
the low half before the high half. Otherwise the compiler may reorder the writes
and validation in Xen will fail.

From: Jan Beulich
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable.h

index 3a6f09c1cd5279eb4c3a98d23ffca2bf45f551c5..224c1032c7d8e623431ebb56a10b5f5bc0f12622 100644 (file)
@@ -272,7 +272,16 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
        pte_t pte;
        if (full) {
                pte = *ptep;
+#ifdef CONFIG_X86_PAE
+               /* Cannot do this in a single step, as the compiler may
+                  issue the two stores in either order, but the hypervisor
+                  must not see the high part before the low one. */
+               ptep->pte_low = 0;
+               barrier();
+               ptep->pte_high = 0;
+#else
                *ptep = __pte(0);
+#endif
        } else {
                pte = ptep_get_and_clear(mm, addr, ptep);
        }